﻿using Prism.Commands;
using Prism.Mvvm;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;

namespace YIJI_Prism.ViewModels
{
    public class MainWindowViewModel : BindableBase
    {
        private string _title = "Prism Application";
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        public MainWindowViewModel()
        {
            TestThread = new DelegateCommand(Execute, TestThreadEnable);
        }

        public DelegateCommand TestThread { get; private set; }

        private bool testThreadEnable = true;
        private bool TestThreadEnable()
        {

            return testThreadEnable;
        }


        private async void Execute()
        {
            testThreadEnable = false;
            Title += "...";
            await Task.Run(() => Thread.Sleep(5000));
            Title = Title.Replace(".", "");

            YIJINLog.Info("testLog" + Title);
            testThreadEnable = true;
        }

    }
}
